\chapter{Implementation}
\label{chap:implementation}

The game has been implemented as a \emph{Java}\footnote{See more at: http://www.java.com/en, (10.02.2012)} application. It uses an external game engine \emph{Slick}\footnote{See more at: http://slick.cokeandcode.com, (10.02.2012)} which is a 2D game library based on \emph{LWJGL}\footnote{See more at: http://lwjgl.org, (10.02.2012)} \emph{OpenGL}\footnote{See more at: http://www.opengl.org, (10.02.2012)} binding for Java.

In the interface we were using a modified version of the \emph{Sticky}\footnote{See more at: http://www.anotherearlymorning.com/2009/01/slick-gui-with-sticky-buttons, (10.02.2012)} button library.

For the required path finding tasks we used a Java implementation of the \emph{A*}\footnote{See more at: http://robotacid.com/PBeta/AILibrary/AStar, (10.02.2012)} algorithm.

The planning systems of our game can be found in chapter \ref{chap:planners}.
The default one is SGPlan~\cite{chen2004sgplan} that can be replaced with any STRIPS-like planner, capable of solving problems in PDDL 2.2~\cite{edelkamp2003pddl} with a few modifications in the source code. In fact there is already an interface that can work with several different planners.

The planners were used through a PDDL domain and problem file. The domain is a centralized in the whole game, and the problem file is dynamically generated based on the current game situation.
The output of the planning system is system specifically parsed and translated into agent action.

Our program is also capable to use \emph{Planning4J}\footnote{See more at: http://code.google.com/p/planning4j, (10.02.2012)} which is a Java API for connecting various AI planners; this tool was recently developed at \emph{AMIS group}\footnote{See more at: http://amis.mff.cuni.cz, (10.02.2012)}, \emph{Faculty of Mathematics and Physics}\footnote{See more at: http://www.mff.cuni.cz, (10.02.2012)}, \emph{Charles University in Prague}.

As a build automation tool we used \emph{Maven}\footnote{See more at: http://maven.apache.org, (10.02.2012)}.

The program was written in a way to be system independent; however the majority of the tested planners support only UNIX-like systems, so the use of our program is limited to this platform family.

\section{Program structure}

\begin{figure}[H]
	\begin{center}
	\includegraphics[width=80mm]{../img/progArchitecture.eps}
	\end{center}	
	\caption{The simplified diagram of our program's architecture}
	\label{fig:progArchitecture}
\end{figure}

As represented in figure~\ref{fig:progArchitecture} the user interacts with the program through a graphic interface that connects him with the Player object implementing the actions he is capable to execute in the game world. The GameMap is a container holding the world layout and the acting agents. Planning is completed in a dedicated thread (PlanningThread) that connects to external planning system through several possible interfaces.

\section{Availability}

The game prototype is open-source and it is available for download on its homepage: \emph{http://code.google.com/p/burglar-game}.



